<template>
    <div class="item" @click="tostore">
        <img :src="item.pic" alt="">
        <div class="item-right">
            <div class="title">{{ item.title }}</div>
            <div class="sales">{{ item.sales }}</div>
            <div class="price">{{ item.price }}</div>
            <div class="label">
                <div v-for="(i, index) in item.label" :key="index">
                    {{ i }}
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { useRouter } from 'vue-router';
export default {
    props: ['item'],
    setup() {
        const router = useRouter()
        const tostore = () => {
            router.push('/store')
        }

        return { tostore }
    }
}
</script>

<style lang="scss" scoped>
.item {
    margin-top: 5px;
    background-color: #fff;
    display: flex;
    justify-content: space-evenly;
    border-radius: 10px;
    padding-left: 10px;

    img {
        margin: 10px 0 10px 10px;
        width: 120px;
        height: 120px;
        border-radius: 10px;
    }

    .item-right {
        margin-left: 15px;
        display: flex;
        font-size: 14px;
        flex-direction: column;
        justify-content: space-evenly;

        .title {
            font-size: 18px;
            font-weight: 600;
        }

        .label {
            display: flex;

            div {
                background-color: #ffc400;
                margin-right: 5px;
                border-radius: 5px;
                padding: 2px;
            }
        }
    }
}
</style>